package org.uim.cricket.updater.fetch.impl;

import org.uim.cricket.updater.fetch.Fetchable;
import org.uim.cricket.util.web.WebHTMLReader;

public class FromURLFetcher implements Fetchable {

	private String url = null;
	
	public FromURLFetcher() {
		
	}
	
	@Override
	public StringBuffer fetch(String input) throws Exception {
		//if (this.url == null) throw new IllegalArgumentException("URL can't be empty!");
		
		this.url = input;
		WebHTMLReader html = new WebHTMLReader(this.url);
		StringBuilder buffer = html.readPage();
		
		return new StringBuffer(buffer.toString());
	}
	
	public void setUrl(String url) {
		this.url = url;
	}
	
	public String getUrl() {
		return url;
	}
	
}
